#pragma once

#include "lg.h"
#include "lg_init.h"
#include "lg_ref.h"

struct LGVertex {
    LGRef ref;
    LGVertexAttr attrs[8];
    unsigned attrCount;
    unsigned eleSize;
    unsigned totalData;
    unsigned totalIndexs;
};

struct LGVertexBackend {
    size_t(*sizeofVertex)();
    int (*newVertex)(LGVertex* vertex, unsigned cap);
    void (*freeVertex)(LGVertex* vertex);
    void (*clearVertex)(LGVertex* vertex);
    void (*clearVertexCap)(LGVertex* vertex);
    void (*uploadVertex)(LGVertex* vertex);
    void (*pushData)(LGVertex* vertex, char* p, unsigned count);
    void (*pushIndexs)(LGVertex* vertex, unsigned* p, unsigned count);
};

LG_API int
lgInitVertexContext(LGConfig* config, LGVertexBackend* backend);

